import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("请输入学生数量：");
        int num = scanner.nextInt();
        scanner.nextLine(); // 消耗换行符

        Student[] students = new Student[num];

        for (int i = 0; i < num; i++) {
            System.out.println("请输入第 " + (i + 1) + " 个学生的学号：");
            String studentId = scanner.nextLine();
            System.out.println("请输入第 " + (i + 1) + " 个学生的姓名：");
            String name = scanner.nextLine();
            System.out.println("请输入第 " + (i + 1) + " 个学生的年龄：");
            int age = scanner.nextInt();
            scanner.nextLine(); // 消耗换行符

            students[i] = new Student(studentId, name, age);
        }

        // 遍历数组并打印学生信息
        System.out.println("所有学生信息如下：");
        for (Student student : students) {
            System.out.println(student);
        }

        scanner.close();
    }
}

